package com.banyuan.controller;

import com.banyuan.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author yzt
 */
@Controller
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private IAccountService accountService;

    @RequestMapping("/tran")
    public ModelAndView tran(Integer id1, Integer id2, Double money) {
        int update = accountService.update(id1, id2, money);
        ModelAndView mv = new ModelAndView("tran");
        if (update > 0) {
            mv.addObject("msg","转账成功");
        } else {
            mv.addObject("msg","转账失败");
        }
        return mv;
    }
}
